﻿using Admin.ApplicationLib.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace Admin.ApplicationLib.EntityConfigurations;

public class PermissionEntityTypeConfiguration : IEntityTypeConfiguration<PermissionEntity>
{
    public void Configure(EntityTypeBuilder<PermissionEntity> builder)
    {
        builder.ToTable("AspNetPermissions").HasKey(p => p.Id);

        builder.HasOne<PermissionEntity>().WithMany().HasForeignKey(p => p.ParentId);
    }
}